﻿using System;

namespace jQueryLib
{
    partial class JQueryInstance
    {
        /// <summary>
        /// Bind an event handler to the "error" JavaScript event.
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public abstract JQueryInstance Error(Action handler);

        /// <summary>
        /// Bind an event handler to the "resize" JavaScript event.
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public abstract JQueryInstance Resize(Action handler);

        /// <summary>
        /// trigger "resize" event on an element.
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance Resize();

        /// <summary>
        /// Bind an event handler to the "scroll" JavaScript event
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public abstract JQueryInstance Scroll(Action handler);

        /// <summary>
        /// trigger "scroll" event on an element.
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance Scroll();

        /// <summary>
        /// Bind an event handler to the "load" JavaScript event.
        /// This event can be sent to any element associated with a URL: images, scripts, frames, iframes, and the window object.
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public abstract JQueryInstance Load(Action handler);

        /// <summary>
        /// Specify a function to execute when the DOM is fully loaded.
        /// The .ready() method can only be called on a jQuery object matching the current document, so the selector can be omitted.
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public abstract JQueryInstance Ready(Action handler);

        /// <summary>
        /// Bind an event handler to the "unload" JavaScript event.
        /// The unload event is sent to the window element when the user navigates away from the page. 
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public abstract JQueryInstance Unload(Action handler);

        /// <summary>
        /// Attach a handler to an event for the elements.
        /// </summary>
        /// <param name="eventType"></param>
        /// <param name="handler"></param>
        /// <returns></returns>
        public abstract JQueryInstance Bind(string eventType, Action<JQueryEvent> handler);

        /// <summary>
        /// Attach a handler to an event for the elements.
        /// </summary>
        /// <param name="eventType"></param>
        /// <param name="handler">return false prevents the default action from occurring and stops the event from bubbling.</param>
        /// <returns></returns>
        public abstract JQueryInstance Bind(string eventType, Func<bool, JQueryEvent> handler);

        /// <summary>
        /// Remove all event handler from the elements.
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance Unbind();

        /// <summary>
        /// Remove a previously-attached event handler from the elements.
        /// </summary>
        /// <param name="eventType"></param>
        /// <returns></returns>
        public abstract JQueryInstance Unbind(string eventType);

        /// <summary>
        /// Remove a previously-attached event handler from the elements.
        /// </summary>
        /// <param name="eventType"></param>
        /// <param name="handler"></param>
        /// <returns></returns>
        public abstract JQueryInstance Unbind(string eventType, Delegate handler);

        /// <summary>
        /// Unbinds the corresponding 'return false' function that was bound.
        /// </summary>
        /// <param name="eventType"></param>
        /// <param name="false"></param>
        /// <returns></returns>
        public abstract JQueryInstance Unbind(string eventType, bool @false);

        /// <summary>
        /// Execute all handlers and behaviors attached to the matched elements for the given event type.
        /// </summary>
        /// <param name="eventType"></param>
        /// <param name="paras"></param>
        /// <returns></returns>
        public abstract JQueryInstance Trigger(string eventType, params object[] paras);

        /// <summary>
        /// Execute all handlers and behaviors attached to the matched elements for the given event.
        /// </summary>
        /// <param name="evt"></param>
        /// <returns></returns>
        public abstract JQueryInstance Trigger(JQueryEvent evt);

        /// <summary>
        /// Execute all handlers attached to an element for an event.
        /// </summary>
        /// <param name="eventType"></param>
        /// <param name="paras"></param>
        /// <returns></returns>
        public abstract void TriggerHandler(string eventType, params object[] paras);

        /// <summary>
        /// Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements.
        /// </summary>
        /// <param name="selector">A selector to filter the elements that trigger the event.</param>
        /// <param name="eventType">A string containing one or more space-separated JavaScript event types, such as "click" or "keydown," or custom event names.</param>
        /// <param name="handler">A function to execute at the time the event is triggered.</param>
        /// <returns></returns>
        public abstract JQueryInstance Delegate(string selector, string eventType, Action<JQueryEvent> handler);

        /// <summary>
        /// unbind all delegated events
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance Undelegate();

        /// <summary>
        /// unbind delegated events
        /// </summary>
        /// <param name="selector"></param>
        /// <param name="eventType"></param>
        /// <returns></returns>
        public abstract JQueryInstance Undelegate(string selector, string eventType);

        /// <summary>
        /// unbind handler from delegated events
        /// </summary>
        /// <param name="selector"></param>
        /// <param name="eventType"></param>
        /// <param name="handler"></param>
        /// <returns></returns>
        public abstract JQueryInstance Undelegate(string selector, string eventType, Delegate handler);

        /// <summary>
        /// unbind all delegated events within namespace
        /// </summary>
        /// <param name="namespace"></param>
        /// <returns></returns>
        public abstract JQueryInstance Undelegate(string @namespace);

        /// <summary>
        /// Attach an event handler function to the selected elements.
        /// </summary>
        /// <param name="eventType"></param>
        /// <param name="handler"></param>
        /// <returns></returns>
        public abstract JQueryInstance On(string eventType, Action<JQueryEvent> handler);

        /// <summary>
        /// Attach an event handler function to the selected elements.
        /// </summary>
        /// <param name="eventType"></param>
        /// <param name="selector"></param>
        /// <param name="handler"></param>
        /// <returns></returns>
        public abstract JQueryInstance On(string eventType, string selector, Action<JQueryEvent> handler);

        /// <summary>
        /// Remove all event handler.
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance Off();

        /// <summary>
        /// Remove all event handler for the event type.
        /// </summary>
        /// <param name="eventType"></param>
        /// <returns></returns>
        public abstract JQueryInstance Off(string eventType);

        /// <summary>
        /// Remove an event handler on matched element.
        /// </summary>
        /// <param name="eventType"></param>
        /// <param name="selector"></param>
        /// <returns></returns>
        public abstract JQueryInstance Off(string eventType, string selector);

        /// <summary>
        /// Remove an event handler.
        /// </summary>
        /// <param name="eventType"></param>
        /// <param name="selector"></param>
        /// <param name="handler"></param>
        /// <returns></returns>
        public abstract JQueryInstance Off(string eventType, string selector, Delegate handler);

        /// <summary>
        /// Attach a handler to an event for the elements. The handler is executed at most once per element.
        /// </summary>
        /// <param name="eventType"></param>
        /// <param name="handler"></param>
        /// <returns></returns>
        public abstract JQueryInstance One(string eventType, Action<JQueryEvent> handler);

        /// <summary>
        /// Attach a handler to an event for the elements. The handler is executed at most once per element.
        /// </summary>
        /// <param name="eventType"></param>
        /// <param name="selector"></param>
        /// <param name="handler"></param>
        /// <returns></returns>
        public abstract JQueryInstance One(string eventType, string selector, Action<JQueryEvent> handler);

        /// <summary>
        ///  Bind an event handler to the "focusin" event.
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public abstract JQueryInstance Focusin(Action<JQueryEvent> handler);

        /// <summary>
        ///  Bind an event handler to the "focusout" event.
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public abstract JQueryInstance Focusout(Action<JQueryEvent> handler);

        /// <summary>
        /// Trigger "keydown" event on an element
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance Keydown();

        /// <summary>
        /// Bind an event handler to the "keydown" JavaScript event
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public abstract JQueryInstance Keydown(Action<JQueryEvent> handler);

        /// <summary>
        /// Trigger "keyup" event on an element
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance Keyup();

        /// <summary>
        /// Bind an event handler to the "keyup" JavaScript event
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public abstract JQueryInstance Keyup(Action<JQueryEvent> handler);

        /// <summary>
        /// Trigger "keypress" event on an element
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance Keypress();

        /// <summary>
        /// Bind an event handler to the "keypress" JavaScript event
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public abstract JQueryInstance Keypress(Action<JQueryEvent> handler);

        /// <summary>
        /// Trigger "click" event on an element
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance Click();

        /// <summary>
        /// Bind an event handler to the "click" JavaScript event
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public abstract JQueryInstance Click(Action<JQueryEvent> handler);

        /// <summary>
        /// Trigger "dblclick" event on an element
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance Dblclick();

        /// <summary>
        /// Bind an event handler to the "dblclick" JavaScript event
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public abstract JQueryInstance Dblclick(Action<JQueryEvent> handler);

        /// <summary>
        /// Trigger "mousedown" event on an element
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance Mousedown();

        /// <summary>
        /// Bind an event handler to the "mousedown" JavaScript event
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public abstract JQueryInstance Mousedown(Action<JQueryEvent> handler);

        /// <summary>
        /// Trigger "mouseup" event on an element
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance Mouseup();

        /// <summary>
        /// Bind an event handler to the "mouseup" JavaScript event
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public abstract JQueryInstance Mouseup(Action<JQueryEvent> handler);


        /// <summary>
        /// Trigger "mouseenter" event on an element
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance Mouseenter();

        /// <summary>
        /// Bind an event handler to the "mouseenter" JavaScript event
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public abstract JQueryInstance Mouseenter(Action<JQueryEvent> handler);

        /// <summary>
        /// Trigger "mouseleave" event on an element
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance Mouseleave();

        /// <summary>
        /// Bind an event handler to the "mouseleave" JavaScript event
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public abstract JQueryInstance Mouseleave(Action<JQueryEvent> handler);

        /// <summary>
        /// Trigger "mouseout" event on an element
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance Mouseout();

        /// <summary>
        /// Bind an event handler to the "mouseout" JavaScript event
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public abstract JQueryInstance Mouseout(Action<JQueryEvent> handler);

        /// <summary>
        /// Trigger "mouseover" event on an element
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance Mouseover();

        /// <summary>
        /// Bind an event handler to the "mouseover" JavaScript event
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public abstract JQueryInstance Mouseover(Action<JQueryEvent> handler);

        /// <summary>
        /// Trigger "mousemove" event on an element
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance Mousemove();

        /// <summary>
        /// Bind an event handler to the "mousemove" JavaScript event
        /// </summary>
        /// <param name="handler"></param>
        /// <returns></returns>
        public abstract JQueryInstance Mousemove(Action<JQueryEvent> handler);

        /// <summary>
        /// Bind a single handler to the matched elements, to be executed when the mouse pointer enters or leaves the elements.
        /// </summary>
        /// <param name="handlerInOut"></param>
        /// <returns></returns>
        public abstract JQueryInstance Hover(Action<JQueryEvent> handlerInOut);

        /// <summary>
        /// Bind two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements.
        /// </summary>
        /// <param name="handlerIn"></param>
        /// <param name="handlerOut"></param>
        /// <returns></returns>
        public abstract JQueryInstance Hover(Action<JQueryEvent> handlerIn, Action<JQueryEvent> handlerOut);

        /// <summary>
        /// Bind two or more handlers to the matched elements, to be executed on alternate clicks.
        /// </summary>
        /// <param name="handlerEven">A function to execute every even time the element is clicked.</param>
        /// <param name="handlerOdd">A function to execute every odd time the element is clicked.</param>
        /// <returns></returns>
        public abstract JQueryInstance Toggle(Action<JQueryEvent> handlerEven, Action<JQueryEvent> handlerOdd);

        /// <summary>
        /// Bind two or more handlers to the matched elements, to be executed on alternate clicks.
        /// </summary>        
        /// <returns></returns>
        public abstract JQueryInstance Toggle(params Action<JQueryEvent>[] handlers);
    }
}
